﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EMFSimpleSample
{
    public partial class Form1 : Form
    {
        Size OrgSize = Size.Empty;
        public Form1()
        {
            InitializeComponent();

            OrgSize = this.mediaPlayer1.ClientSize;
            this.mediaPlayer1.Resize += new System.EventHandler(this.mediaPlayer1_Resize);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.mediaPlayer1.Play("http://www.coppercoins.de/downloads/demo.wmv");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void mediaPlayer1_Resize(object sender, EventArgs e)
        {
            if (OrgSize != Size.Empty)
            {
                Size newSize = this.mediaPlayer1.ClientSize;
                if (newSize == OrgSize)
                    return;
                Size diffSize = new Size(newSize.Width - OrgSize.Width, newSize.Height - OrgSize.Height);
                this.panel1.ClientSize = new Size(this.panel1.ClientSize.Width + diffSize.Width, this.panel1.ClientSize.Height + diffSize.Height);
                OrgSize = newSize;
            }
        }
    }
}